@import "../../../style/default";
@import "../../input/style/mixin";

/* ng-select */

.ng-select {
  &.ng-select-opened {
    > .ng-select-container {
      background: #fff;
      border-color: #b3b3b3 #ccc #d9d9d9;
      transform-origin: 50% 50%;
      &:hover {
        border-color: $ng-select-color;
        outline: 0;
        -webkit-box-shadow: 0 0 0 $ng-select-shadow-size $ng-select-shadow;
        box-shadow: 0 0 0 $ng-select-shadow-size $ng-select-shadow;
      }
      .ng-arrow {
        top: 18px;
        transform: rotate(180deg);
        transition: all .6s;
        &:before {
          top: -2px;
        }
        &:hover {
          border-color: transparent transparent #666;
        }
      }
    }
    &.ng-select-bottom {
      > .ng-select-container {
        border-bottom-right-radius: 0;
        border-bottom-left-radius: 0;
        &:focus, &:active {
          border-color: $ng-select-color;
          outline: 0;
          box-shadow: 0 0 0 $ng-select-shadow-size $ng-select-shadow;
        }
      }
    }
    &.ng-select-top {
      > .ng-select-container {
        border-top-right-radius: 0;
        border-top-left-radius: 0;
      }
    }
  }
  &.ng-select-focused {
    &:not(.ng-select-opened) > .ng-select-container {
      border-color: $ng-select-color;
      box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), $ng-select-shadow;
    }
  }
  .ng-has-value {
    .ng-placeholder {
      display: none;
    }
    &:hover {
      .ng-arrow-wrapper {
        opacity: 0;
      }
    }
  }
  .ng-select-container {
    background-color: #fff;
    border-radius: $ng-select-border-radius;
    //border: 1px solid #d9d9d9;
    @include border;
    min-height: $input-height-base;
    align-items: center;
    &:hover {
      box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
      border-color: $ng-select-color;
    }
    .ng-value-container {
      align-items: center;
      padding-left: 10px;
      .ng-placeholder {
        color: #bfbfbf;
      }
    }
  }
  &.ng-select-disabled {
    .ng-select-container {
      background-color: $ng-select-disabled-bg;
      color: $ng-select-disabled-color;
      cursor: not-allowed;
      border-color: $ng-select-border-color;
      &:focus, &:active, &:hover {
        border-color: $ng-select-border-color !important;
        //outline: 0;
        box-shadow: none !important;
      }
      span {
        cursor: not-allowed;
      }
      .ng-arrow {
        color: $ng-select-arrow-disabled-color;
      }
    }
  }
  &.ng-select-single {
    .ng-select-container {
      height: $input-height-base;
      &:focus, &:active {
        border-color: $ng-select-color;
        outline: 0;
        box-shadow: 0 0 0 $ng-select-shadow-size $ng-select-shadow;
      }
      .ng-value-container {
        .ng-input {
          left: 0;
          padding-left: 10px;
          padding-right: 50px;
          top: 5px;
        }
      }
    }
    //&.ng-select-disabled {
    //  .ng-select-container {
    //    background-color: $ng-select-disabled-bg;
    //    color: $ng-select-disabled-color;
    //    cursor: not-allowed;
    //    border-color: $ng-select-border-color;
    //    &:focus, &:active, &:hover {
    //      border-color: $ng-select-border-color;
    //      outline: 0;
    //      box-shadow: none;
    //    }
    //    span {
    //      cursor: not-allowed;
    //    }
    //  }
    //}
  }
  &.ng-select-multiple {
    &.ng-select-disabled {
      > .ng-select-container .ng-value-container .ng-value {
        background-color: #f9f9f9;
        border: 1px solid #e3e3e3;
        .ng-value-label {
          padding: 0 5px;
        }
      }
    }
    .ng-select-container {
      .ng-value-container {
        padding-left: 7px;
        padding-top: 4px;
        .ng-value {
          font-size: 14px;
          margin-right: 4px;
          margin-bottom: 5px;
          background-color: #fafafa;
          border-radius: 2px;
          border: 1px solid #e8e8e8;
          height: 20px;
          line-height: 16px;
          color: rgba(0, 0, 0, 0.65);
          &.ng-select-disabled {
            background-color: #f9f9f9;
            border: 1px solid #e3e3e3;
          }
          .ng-value-label {
            display: inline-block;
            padding: 0 5px 0 10px;
            line-height: 1.4;
          }
          .ng-value-icon {
            display: inline-block;
            padding: 0 5px 0 0;
            font-size: 16px;
            color: rgba(0, 0, 0, 0.45);
            transition: color .3s;
            &:hover {
              color: #404040;
            }
          }
        }
        .ng-input {
          padding-bottom: 3px;
          padding-left: 3px;
        }
        .ng-placeholder {
          top: 5px;
          padding-bottom: 5px;
          padding-left: 3px;
        }
      }
    }
  }
  .ng-clear-wrapper {
    color: rgba(0, 0, 0, 0.45);
    .ng-clear {
      transition: color 0.3s ease, opacity 0.15s ease;
      &:before {
        display: block;
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
      }
      &:hover {
        color: rgba(0, 0, 0, 0.65);
      }
    }
  }
  .ng-spinner-zone {
    padding-right: 5px;
    padding-top: 5px;
  }
  .ng-arrow-wrapper {
    transform-origin: 50% 50%;
    width: 25px;
    .ng-arrow {
      color: $ng-select-arrow-color;
      font-size: 12px;
      transition: all .6s;
      &:hover {
        border-top-color: #666;
      }
    }
  }
  .ng-table {
    .ng-dropdown-header {
      border-bottom: 1px solid #ccc;
      padding: 0;
      background: #eaeaea;
      font-weight: bold;
      .ng-table-row {
        margin-right: 8px;
        text-align: center;
        .ng-table-col {
          padding: 5px 7px;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
          border-right: 1px solid #d4d4d4;
        }
      }
    }
    .scroll-host {
      overflow-y: scroll;
      margin-bottom: 0;
    }
    .ng-dropdown-panel-items {
      .ng-option {
        padding: 0;
        .ng-table-row {
          text-align: center;
          border-bottom: 1px solid #d4d4d4;
          & div::-webkit-scrollbar {
            height: 6px;
            width: 6px;
          }
          .ng-table-col {
            padding: 5px 7px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
            border-right: 1px solid #d4d4d4;
            min-height: 31px;
          }
        }
        &.ng-option-disabled {
          padding: 5px 7px;
        }
      }
    }
  }
}

.ng-dropdown-panel {
  background-color: #fff;
  border: 1px solid #ccc;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
  &.ng-select-bottom {
    top: 100%;
    border-radius: 8px;
    border-top-color: #e6e6e6;
    -webkit-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    .ng-dropdown-panel-items {
      .ng-option {
        &:last-child {
          border-bottom-right-radius: 4px;
          border-bottom-left-radius: 4px;
          .ng-table-row {
            border-bottom: 0;
          }
        }
      }
    }
  }
  &.ng-select-top {
    bottom: 100%;
    border-radius: 4px;
    border-bottom-color: #e6e6e6;
    margin-bottom: 1px;
    .ng-dropdown-panel-items {
      .ng-option {
        &:first-child {
          border-top-right-radius: 4px;
          border-top-left-radius: 4px;
        }
      }
    }
  }
  .ng-dropdown-header {
    border-bottom: 1px solid #ccc;
    padding: 5px 7px;
  }
  .ng-dropdown-footer {
    border-top: 1px solid #ccc;
    padding: 5px 7px;
  }
  .ng-dropdown-panel-items {
    margin-bottom: 1px;
    border-radius: 4px;
    .ng-optgroup {
      user-select: none;
      cursor: default;
      padding: 8px 10px;
      transition: background 0.3s ease;
      &.ng-select-disabled {
        color: rgba(0, 0, 0, .25);
      }
      &.ng-option-marked {
        background-color: $ng-select-option-color;
        color: #333;
        transition: background 0.3s ease;
        &:after {
          color: #ddd;
        }
      }
      &.ng-option-selected {
        color: #333;
        background-color: $ng-select-selected-color;
        font-weight: 600;
      }
    }
    .ng-option {
      background-color: #fff;
      padding: 4px 10px;
      transition: background 0.3s ease;
      &.ng-option-selected {
        color: #333;
        background-color: $ng-select-selected-color;
        .ng-option-label {
          font-weight: 600;
        }
      }
      &.ng-option-marked {
        background-color: $ng-select-option-color;
        color: #333;
      }
      &.ng-option-disabled {
        color: rgba(0, 0, 0, .25);
        cursor: not-allowed;
        &:hover {
          color: rgba(0, 0, 0, .25);
          background-color: #fff;
          cursor: not-allowed;
        }
      }
      &.ng-option-child {
        padding-left: 22px;
      }
      .ng-tag-label {
        padding-right: 5px;
        font-size: 80%;
        font-weight: 400;
      }
    }
  }
}

.apes-form-item {
  .ag-theme-balham {
    .ng-select {
      padding: 0;
    }
  }
  .ng-select {
    //padding: 6px 0;
    line-height: normal;
    top: 3px;
    margin-bottom: 5px;
    .ng-select-container {
      z-index: 999 !important;
      &:focus {
        border-color: #18948e;
        outline: 0;
        box-shadow: 0 0 0 $ng-select-shadow-size rgba(0, 135, 132, 0.2);
      }
    }
    .ng-dropdown-panel {
      z-index: 1000;
      &.ng-select-bottom {
        //top:34px;
      }
    }
    //&.ng-select-disabled {
    //  > .ng-select-container {
    //    background-color: #fff;
    //    color: rgba(0, 0, 0, .25);
    //    cursor: text;
    //    border-color: #d9d9d9;
    //    &:hover {
    //      border-color: #18948e;
    //    }
    //span {
    //  cursor: text;
    //}
    //.ng-input {
    //  > input {
    //    cursor: text;
    //  }
    //}
    //}
    //}
  }
}

.select-business {
  .ng-input {
    display: none;
  }
  .ng-dropdown-panel {
    display: none;
  }
  .ng-arrow-wrapper {
    display: none;
  }
}
